<%@ page language="java" contentType="text/html;charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack"%>

<chiptrack:checkLogon sourcePage="projectSetup.do"/>
<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.forecast.commons.Constants"%>
<%@ page import="com.scalar.forecast.projectSetup.forms.ProjectSetupForm"%>
<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<HTML><HEAD><TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type="text/css" rel=stylesheet>

<META content="MSHTML 5.50.4807.2300" name=GENERATOR></HEAD>
<BODY bgColor="#ffffff" leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<SCRIPT language="JavaScript">
    function submitPage( action )
    {
        if( action == 'EDIT') {
            document.projectSetupForm.action.value = "edit";
        } else if ( action == 'DELETE') {
            document.projectSetupForm.action.value = "delete";
        } else if ( action == 'CONFIRM') {
            document.projectSetupForm.action.value = "confirm";
        }
        document.projectSetupForm.submit();
    }
    function showForecastData ( projName, sPerson)
    {
        var form = document.projectSetupForm;
        projId = form['projectSetup.projectID'].value;
        var url = '<%=chipTracContext%>/projectSetup.do?projectID='+projId+'&projName='+projName+'&sPerson='+sPerson+'&action=<%=Constants.ACTION_LOAD_PROJECT_FORECAST_DETAILS%>';
        newWindow = window.open ( url,"projectForecastView",'channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=yes,width=650,height=550,resizable=yes');

        newWindow.focus();
    }
</SCRIPT>

<!-- Top Header Start-->

    <%
        String userTypeChiptrac = com.scalar.chiptrack.commons.Constants.USER_TYPE_CHIPTRAC + "";
    %>
    <logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/header.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/includes/extHeader.jsp" %>
    </logic:notEqual>

<!-- Top Header End-->

<html:form name="projectSetupForm" method="post" action="/projectSetup.do" scope="session" type="com.scalar.forecast.projectSetup.forms.ProjectSetupForm" >

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
  <TBODY>
  <TR>
	<TD width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>
<!-- Side Navigation start -->
	<logic:equal value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/marketing/marketing_menu.jsp" %>
    </logic:equal>
    <logic:notEqual value="<%=userTypeChiptrac%>" name="user" property="userType" scope="session">
        <%@ include file="/jsp/forecast/external_forecast_menu.jsp" %>
    </logic:notEqual>
    </TD>
<!-- end of the side navigations -->
    <TD bgcolor="#ffffff">
        <IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
        <TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
        <TD valign="top" width="100%">

        <IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
        <BR>
<!-- from here your body starts -->
        <center><span class="NArialW">Project Setup </span></center>
        <nested:nest property="projectSetup">
        <TABLE cellSpacing=0 cellPadding=0 width="85%" align=center border="0">
            <TBODY>
            <TR><TD colspan =7 align="left" class='NArialL'><font styleClass="NArialL" id="message1" color="green"  />&nbsp;</font></TD></TR>
            <TR><TD colspan =7 class="NArialL"><chiptrack:errors styleClass="NArialL" /></TD></TR>
            <TR>
            <TD>
              <TABLE cellSpacing=0 cellPadding=2 width="90%" align=center border="0">
                <TBODY>
                <TR>
                    <logic:equal name="purpose" value="view">
                        <TD colspan=4 align=right>
                            <a href=<%=chipTracContext%>/projectSearch.do><img src="<%=chipTracContext%>/jsp/includes/images/back.gif" border=0 onmouseover="window.status='Click here to go to Project Search screen';return true" onmouseout="window.status='';return true" title="Click here to go to Project Search screen"></a>
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        </TD>
                    </logic:equal>
                    <logic:equal name="purpose" value="save">
                        <TD colspan=3 >
                                <FONT class=NArialL><FONT color="red"><li> Are you sure, you want to
                                <nested:greaterThan property="projectID" value="0"> modify </nested:greaterThan>
                                <nested:lessThan property="projectID" value="0"> save </nested:lessThan> this Project Setup Details ?
                                <logic:equal name="isForecastToBeModified" value="true">
                                    <li>And All the forecast details will also be modified.</li>
                                    <li><a href="javascript:showForecastData('<nested:write name="projectSetup" property="projectName" />','<nested:write name="projectSetup" property="salesPerson" />')">Click Here</a> to view details</li>
                                </logic:equal>
                                </FONT></FONT>
                        </TD>
                        <TD>
                            <a href="javascript:submitPage('CONFIRM');"><img src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" border='0'onmouseover="window.status='Click here to Confirm Project Setup';return true" onmouseout="window.status='';return true" title="CLick here to Confirm Project Setup"></a>
                            &nbsp;&nbsp;
                            <a href="javascript:submitPage('EDIT');"><img src="<%=chipTracContext%>/jsp/includes/images/edit.gif" border=0 onmouseover="window.status='Click here to Edit project setup';return true" onmouseout="window.status='';return true" title="Click here to Edit Project Setup"></a>
                        </TD>
                    </logic:equal>
                    <logic:equal name="purpose" value="delete">
                        <TD colspan=3 >
                            <FONT class=NArialL><FONT color="red"><li> Are you sure, you want to delete this Project Setup Details ?
                            <logic:present name="isForecastEntered">
                                <logic:equal value="true" name="isForecastEntered">
                                    <li>And All the forecast details will also be deleted.</li>
                                    <li><a href="javascript:showForecastData('<nested:write name="projectSetup" property="projectName" />','<nested:write name="projectSetup" property="salesPerson" />')">Click Here</a> to view details</li>
                                </logic:equal>
                            </logic:present>
                            </FONT></FONT>
                        </TD>
                        <TD>
                            <a href="javascript:submitPage('DELETE');"><img src="<%=chipTracContext%>/jsp/includes/images/confirm.gif" border='0'onmouseover="window.status='Click here to delete Project Setup';return true" onmouseout="window.status='';return true" title="CLick here to delete Project Setup"></a>
                            &nbsp;&nbsp;
                            <a href=<%=chipTracContext%>/projectSearch.do><img src="<%=chipTracContext%>/jsp/includes/images/back.gif" border=0 onmouseover="window.status='Click here to go to Project Search screen';return true" onmouseout="window.status='';return true" title="Click here to go to Project Search screen"></a>
                        </TD>
                    </logic:equal>
                <TR><TD colspan=4>&nbsp;</TD></TR>
                </TR>
                <TR>
                  <TD width="20%"><FONT class=NArialL>Sales Person Name:</FONT></TD>
                  <TD width="30%" class="bodytext"> <nested:write name="projectSetup" property="salesPerson" /> </TD>
                  <TD width="20%">&nbsp;</TD>
                  <TD width="30%">&nbsp; </TD>
                </TR>
                <TR>
                  <TD width="20%"><FONT class=NArialL>Customer Name:</FONT></TD>
                  <TD width="30%" class="bodytext"> <nested:write name="projectSetup" property="customerName" /> </TD>
                  <TD width="20%">&nbsp;<FONT class=NArialL><bean:message key="label.sales.endCustomer"/>:</FONT></TD>
                  <TD width="30%" class="bodytext"><nested:write name="projectSetup" property="odmName" /> </TD>
                </TR>
                <TR>
                  <TD width="20%"><FONT class=NArialL><bean:message key="label.sales.endUser"/>:</FONT></TD>
                  <TD width="30%" class="bodytext"><nested:write name="projectSetup" property="endUserName" /> </TD>
                  <TD width="20%">&nbsp;</TD>
                  <TD width="30%" class="bodytext">&nbsp;</TD>
                </TR>
                <TR>
                  <TD width="20%"><FONT class=NArialL>Project Name:</FONT></TD>
                  <TD width="30%" class="bodytext"><nested:write name="projectSetup" property="projectName" /></TD>
                  <TD width="20%">&nbsp;<FONT class=NArialL>Project Status:</FONT></TD>
                  <TD width="30%" class="bodytext"><nested:write name="projectSetup" property="projectStatus" /></TD>
                </TR>
                <% int bgcount = 0;%>
                <nested:iterate name="projectSetup" property="userDefinedFeilds" id="userDefinedField" >
                      <% bgcount = bgcount + 1; %>
                      <% if ( bgcount%2 > 0 ) { %>
                      <TR>
                      <% }%>
                      <TD width="20%" nowrap><% if ( bgcount%2 == 0 ) { %>&nbsp;<% }%><FONT class=NArialL><nested:write name="userDefinedField" property="name" />:</FONT></TD>
                      <TD width="30%" class="bodytext">
                            <nested:write name="userDefinedField" property="value"/>
                      </TD>
                      <% if ( bgcount%2 == 0 ) { %>
                      </TR>
                      <% } %>
                </nested:iterate>

                <TR> <TD colspan="4">&nbsp;</TD> </TR>

                </TBODY>
              </TABLE>
            </TD>
            </TR>

            <TR>
                <TD align="left">
                    <TABLE cellSpacing=0 cellPadding=0 width="90%" border="0" align="center">
                        <TBODY>
                        <TR>
                            <TD colspan="3" bgColor="#993333" width="621"  height="16">
                                <FONT class=NArialL><FONT color="#ffffff">&nbsp;Project-Part Relationships </FONT></FONT>
                            </TD>
                            <TD width="">&nbsp;</TD>
                        </TR>
                        <TR><TD colspan="4">&nbsp;</TD> </TR>
                        <TR>
                          <TD width="25%" valign="top"><FONT class=NArialL>Selected Chips</FONT></TD>
                          <TD width="5%">&nbsp;</TD>
                          <TD width="25%" class="bodytext" nowrap>
                              <logic:iterate name="selectedChipsList" id="selectedChip" >
                                    <bean:write name="selectedChip" property="label"/><br>
                              </logic:iterate>
                          </TD>
                          <TD width="45">&nbsp;</TD>
                        </TR>
                        <TR> <TD colspan="4">&nbsp;</TD> </TR>
                        <TR>
                          <TD width="25%" valign="top"><FONT class=NArialL>Selected Boards</FONT></TD>
                          <TD width="5%">&nbsp;</TD>
                          <TD width="25%" class="bodytext" nowrap>
                               <logic:iterate name="selectedBoardsList" id="selectedBoard">
                                    <bean:write name="selectedBoard" property="label"/> <br>
                               </logic:iterate>
                          </TD>
                          <TD width="45">&nbsp;</TD>
                        </TR>
                        <TR> <TD colspan="4">&nbsp;</TD> </TR>
                        <TR>
                          <TD width="25%" valign="top"><FONT class=NArialL>Selected Kits</FONT></TD>
                          <TD width="5%">&nbsp;</TD>
                          <TD width="25%" class="bodytext" nowrap>
                               <logic:iterate name="selectedKitsList" id="selectedKit">
                                    <bean:write name="selectedKit" property="label"/> <br>
                              </logic:iterate>
                          </TD>
                          <TD width="45">&nbsp;</TD>
                        </TR>
                      </TBODY>
                    </TABLE>
               </TD>
            </TR>
           </TBODY>
        </TABLE>
    <nested:hidden property="projectID"/>
    <input type="hidden" name="action" value="">
    </nested:nest>
    </html:form>
    </TD>
<!-- till here -->
    <TD bgcolor="#ffffff"><IMG height=1 src="images/spacer.gif" width=1></TD>
  </TR>
  </TBODY>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
</BODY>
</HTML>

